package com.earl.eatbao.web;

import static org.slf4j.LoggerFactory.getLogger;

import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.earl.eatbao.commons.vo.ResultMessage;
import com.earl.eatbao.service.ClassificationService;
import com.wordnik.swagger.annotations.ApiOperation;

/**
 * @author Administrator
 * @version 1.0
 * @created 23-十一月-2016 16:55:14
 */
@RestController
@RequestMapping("/classification")
public class ClassificationController extends BaseController {

	// desc:日记工具logger
	private static final Logger logger = getLogger(ClassificationController.class);

	@Autowired
	private ClassificationService classificationService;

	/**
	 * 查询所有商品分类
	 * @return
	 */
	@ApiOperation(value = "获取所有商品分类", notes = "获取所有商品分类", httpMethod = "GET", response = String.class)
	@RequestMapping(value="/all",  method = RequestMethod.GET)
	public ResponseEntity<ResultMessage> findAll(){
		// desc: 封装操作结果
		ResultMessage result = new ResultMessage();
		result.getResultParm().put("classificationList", classificationService.findAll());
		
		result.setServiceResult(true);
		result.setMessageCode(200l);
		result.setResultInfo("请求操作成功");

		return new ResponseEntity<ResultMessage>(result, HttpStatus.OK);
	}

}